<?php
//header("Content-type: text/ xml");
/**
 * @file
 * User has successfully authenticated with Twitter. Access tokens saved to session and DB.
 */

/* Load required lib files. */
//session_start();
require_once('twitteroauth/twitteroauth.php');
require_once('config.php');

function getConnectionWithAccessToken($oauth_token, $oauth_token_secret) 
{
//	echo $oauth_token . " " .$oauth_token_secret."<br/>";
  $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $oauth_token, $oauth_token_secret);
  return $connection;
}
//$access_token = $_SESSION['access_token'];

//$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);

//$connection = getConnectionWithAccessToken($_GET['Access_token'], $_GET['Access_token_secret']);
	
		$connection = getConnectionWithAccessToken( "85076816-Vai77y0Ge79dYGoaxcBzpp7Xj0fQSiuIjVPyDB6ZX", "eVsTjWud2VQrdCN7DhI3h0MAdj1nm32NEuFwbtSFIJc" );
	
		//me
		//$connection = getConnectionWithAccessToken("613955770-dioUAbZ3RLmx2bun4YbYdGp9OwTYo6FX3bGEu5Ag", "GGKs6kSaANvXzBRham8pjhCCIBEf34uMdaL1q1POPU");
	$query = $connection->get("https://api.twitter.com/1/statuses/home_timeline.json?count=10");
	
	if( isset($query->errors) )
	{
		echo $query->errors[0]->message;
		
		return;
	}
	
	echo '<pre>';
var_dump($query);
echo '</pre>';



  $Rate_Limit = $connection->get("https://api.twitter.com/1/account/rate_limit_status.json");
  
  
  echo 'Limit_____________________Test';
  echo '<pre>';
var_dump($Rate_Limit);
echo '</pre>';
?>